<?php
namespace App\JsonRpc\impl;

use Hyperf\RpcServer\Annotation\RpcService;
use App\JsonRpc\IPayLogService;
use App\Model\PayLog;

/**
 * 注意，如希望通过服务中心来管理服务，需在注解内增加 publishTo 属性
 * @RpcService(name="PayLogService", protocol="jsonrpc-http", server="jsonrpc-http")
 */
class PayLogService implements IPayLogService
{
    public function getByOrderNo($orderNoArray) {
        $logs = PayLog::query()->whereIn('order_no', $orderNoArray)->get()->toArray();
        $logs = array_column($logs, null, 'order_no');
        foreach ($orderNoArray as $orderno) {
            if (empty($logs[$orderno])) $logs[$orderno] = null;
        }
        return $logs;
    }
}